//
//	HotList.m
//
//	Create by mafeng on 9/8/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "HotList.h"

NSString *const kHotListFirstletter = @"firstletter";
NSString *const kHotListIdField = @"id";
NSString *const kHotListImg = @"img";
NSString *const kHotListName = @"name";
NSString *const kHotListOrdercount = @"ordercount";

@interface HotList ()
@end
@implementation HotList




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kHotListFirstletter] isKindOfClass:[NSNull class]]){
		self.firstletter = dictionary[kHotListFirstletter];
	}	
	if(![dictionary[kHotListIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kHotListIdField];
	}

	if(![dictionary[kHotListImg] isKindOfClass:[NSNull class]]){
		self.img = dictionary[kHotListImg];
	}	
	if(![dictionary[kHotListName] isKindOfClass:[NSNull class]]){
		self.name = dictionary[kHotListName];
	}	
	if(![dictionary[kHotListOrdercount] isKindOfClass:[NSNull class]]){
		self.ordercount = dictionary[kHotListOrdercount];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.firstletter != nil){
		dictionary[kHotListFirstletter] = self.firstletter;
	}
	dictionary[kHotListIdField] = self.idField;
	if(self.img != nil){
		dictionary[kHotListImg] = self.img;
	}
	if(self.name != nil){
		dictionary[kHotListName] = self.name;
	}
	dictionary[kHotListOrdercount] = self.ordercount;
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.firstletter != nil){
		[aCoder encodeObject:self.firstletter forKey:kHotListFirstletter];
	}
	[aCoder encodeObject:self.idField forKey:kHotListIdField];	if(self.img != nil){
		[aCoder encodeObject:self.img forKey:kHotListImg];
	}
	if(self.name != nil){
		[aCoder encodeObject:self.name forKey:kHotListName];
	}
	[aCoder encodeObject:self.ordercount forKey:kHotListOrdercount];
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.firstletter = [aDecoder decodeObjectForKey:kHotListFirstletter];
	self.idField = [aDecoder decodeObjectForKey:kHotListIdField];
	self.img = [aDecoder decodeObjectForKey:kHotListImg];
	self.name = [aDecoder decodeObjectForKey:kHotListName];
	self.ordercount = [aDecoder decodeObjectForKey:kHotListOrdercount];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	HotList *copy = [HotList new];

	copy.firstletter = [self.firstletter copyWithZone:zone];
	copy.idField = self.idField;
	copy.img = [self.img copyWithZone:zone];
	copy.name = [self.name copyWithZone:zone];
	copy.ordercount = self.ordercount;

	return copy;
}
@end
